package com.example.business.mapper;

import com.example.business.entity.SysVideo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 视频表 Mapper 接口
 * </p>
 *
 * @author xiong
 * @since 2024-01-27
 */
public interface SysVideoMapper extends BaseMapper<SysVideo> {

    @Select("select * from ( SELECT * FROM sys_video WHERE id >= #{id} ORDER BY id ASC \n" +
            "LIMIT #{limit} ) a UNION ALL select * from ( SELECT * FROM sys_video\n " +
            "WHERE id < #{id} ORDER BY id ASC ) b LIMIT #{limit}")
    public List<SysVideo> getListOrderById(@Param("id")Serializable id,@Param("limit")Integer limit);
}
